#include <vector>
#include <iostream>
using namespace std;

int main()
{
        int n;
        cin>>n;
        vector<vector<int>> matrix(n+1, vector<int>(n+1, 0));
        int max_val = 0;
        for(int i = 1; i <= n; i++){
                for(int j = 1; j <= n; j++){
                        int x;
                        cin>>x;
                        matrix[i][j] = matrix[i-1][j] + matrix[i][j-1] - matrix[i-1][j-1] + x;
                        max_val = max(max_val, matrix[i][j]);       
                }
        }

        return 0;
}